/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Wires.impl;

import EA_Model.IEC61970.Core.impl.ConductingEquipmentImpl;

import EA_Model.IEC61970.Domain.ActivePower;
import EA_Model.IEC61970.Domain.PerCent;
import EA_Model.IEC61970.Domain.ReactivePower;

import EA_Model.IEC61970.Wires.EnergyConsumer;
import EA_Model.IEC61970.Wires.WiresPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Energy Consumer</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.EnergyConsumerImpl#getCustomerCount <em>Customer Count</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.EnergyConsumerImpl#getPfixed <em>Pfixed</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.EnergyConsumerImpl#getPfixedPct <em>Pfixed Pct</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.EnergyConsumerImpl#getQfixed <em>Qfixed</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.EnergyConsumerImpl#getQfixedPct <em>Qfixed Pct</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class EnergyConsumerImpl extends ConductingEquipmentImpl implements EnergyConsumer {
	/**
	 * The cached value of the '{@link #getCustomerCount() <em>Customer Count</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCustomerCount()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Integer customerCount;

	/**
	 * The cached value of the '{@link #getPfixed() <em>Pfixed</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPfixed()
	 * @generated
	 * @ordered
	 */
	protected ActivePower pfixed;

	/**
	 * The cached value of the '{@link #getPfixedPct() <em>Pfixed Pct</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPfixedPct()
	 * @generated
	 * @ordered
	 */
	protected PerCent pfixedPct;

	/**
	 * The cached value of the '{@link #getQfixed() <em>Qfixed</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getQfixed()
	 * @generated
	 * @ordered
	 */
	protected ReactivePower qfixed;

	/**
	 * The cached value of the '{@link #getQfixedPct() <em>Qfixed Pct</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getQfixedPct()
	 * @generated
	 * @ordered
	 */
	protected PerCent qfixedPct;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EnergyConsumerImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return WiresPackage.Literals.ENERGY_CONSUMER;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Integer getCustomerCount() {
		if (customerCount != null && customerCount.eIsProxy()) {
			InternalEObject oldCustomerCount = (InternalEObject)customerCount;
			customerCount = (EA_Model.IEC61970.Domain.Integer)eResolveProxy(oldCustomerCount);
			if (customerCount != oldCustomerCount) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.ENERGY_CONSUMER__CUSTOMER_COUNT, oldCustomerCount, customerCount));
			}
		}
		return customerCount;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Integer basicGetCustomerCount() {
		return customerCount;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCustomerCount(EA_Model.IEC61970.Domain.Integer newCustomerCount) {
		EA_Model.IEC61970.Domain.Integer oldCustomerCount = customerCount;
		customerCount = newCustomerCount;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.ENERGY_CONSUMER__CUSTOMER_COUNT, oldCustomerCount, customerCount));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActivePower getPfixed() {
		if (pfixed != null && pfixed.eIsProxy()) {
			InternalEObject oldPfixed = (InternalEObject)pfixed;
			pfixed = (ActivePower)eResolveProxy(oldPfixed);
			if (pfixed != oldPfixed) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.ENERGY_CONSUMER__PFIXED, oldPfixed, pfixed));
			}
		}
		return pfixed;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActivePower basicGetPfixed() {
		return pfixed;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPfixed(ActivePower newPfixed) {
		ActivePower oldPfixed = pfixed;
		pfixed = newPfixed;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.ENERGY_CONSUMER__PFIXED, oldPfixed, pfixed));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PerCent getPfixedPct() {
		if (pfixedPct != null && pfixedPct.eIsProxy()) {
			InternalEObject oldPfixedPct = (InternalEObject)pfixedPct;
			pfixedPct = (PerCent)eResolveProxy(oldPfixedPct);
			if (pfixedPct != oldPfixedPct) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.ENERGY_CONSUMER__PFIXED_PCT, oldPfixedPct, pfixedPct));
			}
		}
		return pfixedPct;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PerCent basicGetPfixedPct() {
		return pfixedPct;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPfixedPct(PerCent newPfixedPct) {
		PerCent oldPfixedPct = pfixedPct;
		pfixedPct = newPfixedPct;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.ENERGY_CONSUMER__PFIXED_PCT, oldPfixedPct, pfixedPct));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ReactivePower getQfixed() {
		if (qfixed != null && qfixed.eIsProxy()) {
			InternalEObject oldQfixed = (InternalEObject)qfixed;
			qfixed = (ReactivePower)eResolveProxy(oldQfixed);
			if (qfixed != oldQfixed) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.ENERGY_CONSUMER__QFIXED, oldQfixed, qfixed));
			}
		}
		return qfixed;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ReactivePower basicGetQfixed() {
		return qfixed;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setQfixed(ReactivePower newQfixed) {
		ReactivePower oldQfixed = qfixed;
		qfixed = newQfixed;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.ENERGY_CONSUMER__QFIXED, oldQfixed, qfixed));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PerCent getQfixedPct() {
		if (qfixedPct != null && qfixedPct.eIsProxy()) {
			InternalEObject oldQfixedPct = (InternalEObject)qfixedPct;
			qfixedPct = (PerCent)eResolveProxy(oldQfixedPct);
			if (qfixedPct != oldQfixedPct) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.ENERGY_CONSUMER__QFIXED_PCT, oldQfixedPct, qfixedPct));
			}
		}
		return qfixedPct;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PerCent basicGetQfixedPct() {
		return qfixedPct;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setQfixedPct(PerCent newQfixedPct) {
		PerCent oldQfixedPct = qfixedPct;
		qfixedPct = newQfixedPct;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.ENERGY_CONSUMER__QFIXED_PCT, oldQfixedPct, qfixedPct));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case WiresPackage.ENERGY_CONSUMER__CUSTOMER_COUNT:
				if (resolve) return getCustomerCount();
				return basicGetCustomerCount();
			case WiresPackage.ENERGY_CONSUMER__PFIXED:
				if (resolve) return getPfixed();
				return basicGetPfixed();
			case WiresPackage.ENERGY_CONSUMER__PFIXED_PCT:
				if (resolve) return getPfixedPct();
				return basicGetPfixedPct();
			case WiresPackage.ENERGY_CONSUMER__QFIXED:
				if (resolve) return getQfixed();
				return basicGetQfixed();
			case WiresPackage.ENERGY_CONSUMER__QFIXED_PCT:
				if (resolve) return getQfixedPct();
				return basicGetQfixedPct();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case WiresPackage.ENERGY_CONSUMER__CUSTOMER_COUNT:
				setCustomerCount((EA_Model.IEC61970.Domain.Integer)newValue);
				return;
			case WiresPackage.ENERGY_CONSUMER__PFIXED:
				setPfixed((ActivePower)newValue);
				return;
			case WiresPackage.ENERGY_CONSUMER__PFIXED_PCT:
				setPfixedPct((PerCent)newValue);
				return;
			case WiresPackage.ENERGY_CONSUMER__QFIXED:
				setQfixed((ReactivePower)newValue);
				return;
			case WiresPackage.ENERGY_CONSUMER__QFIXED_PCT:
				setQfixedPct((PerCent)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case WiresPackage.ENERGY_CONSUMER__CUSTOMER_COUNT:
				setCustomerCount((EA_Model.IEC61970.Domain.Integer)null);
				return;
			case WiresPackage.ENERGY_CONSUMER__PFIXED:
				setPfixed((ActivePower)null);
				return;
			case WiresPackage.ENERGY_CONSUMER__PFIXED_PCT:
				setPfixedPct((PerCent)null);
				return;
			case WiresPackage.ENERGY_CONSUMER__QFIXED:
				setQfixed((ReactivePower)null);
				return;
			case WiresPackage.ENERGY_CONSUMER__QFIXED_PCT:
				setQfixedPct((PerCent)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case WiresPackage.ENERGY_CONSUMER__CUSTOMER_COUNT:
				return customerCount != null;
			case WiresPackage.ENERGY_CONSUMER__PFIXED:
				return pfixed != null;
			case WiresPackage.ENERGY_CONSUMER__PFIXED_PCT:
				return pfixedPct != null;
			case WiresPackage.ENERGY_CONSUMER__QFIXED:
				return qfixed != null;
			case WiresPackage.ENERGY_CONSUMER__QFIXED_PCT:
				return qfixedPct != null;
		}
		return super.eIsSet(featureID);
	}

} //EnergyConsumerImpl
